<% if @upload.new_record? %>
  alert('Failed');
<% else %>
  if ($('h1#upload_title') !== undefined) {
    $('h1#upload_title').append("<%=j render partial: 'admin/uploads/upload', locals: { upload: @upload } %>");
  }
<% end %>
